﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage.Streams;
using Windows.UI.Text;
using Windows.UI.Xaml;

namespace BoolanElement.UI.Table
{
    public class BooTableDataUnit
    {
        private string dataString;
        public string DataString
        {
            set { dataString = value; }
            get
            {
                return dataString;
            }
        }
        public ITextDocument ContentDocument;
        public InMemoryRandomAccessStream ContentStream;

        public const int StringData = 0;
        public const int ImageData = 1;
        public const int StringAndImageData = 2;
        public int DataType;

        public BooTableDataUnit(String data)
        {
            DataType = BooTableDataUnit.StringData;
            this.DataString = data;
        }

        public BooTableDataUnit(ITextDocument ContentDocument)
        {
            DataType = BooTableDataUnit.StringData;
            this.ContentDocument = ContentDocument;
            ContentDocument.GetText(TextGetOptions.FormatRtf | TextGetOptions.AdjustCrlf, out dataString);
        }

        public BooTableDataUnit(BooTableDataUnit unit)
        {
            this.DataString = unit.DataString;
            this.ContentDocument = unit.ContentDocument;
        }

        public void Load(BooTableDataUnit unit)
        {
            this.DataString = unit.DataString;
            this.ContentDocument = unit.ContentDocument;
        }

        public BooTableDataUnit Clone()
        {
            BooTableDataUnit unit = new BooTableDataUnit(this);
            return unit;
        }
    }
}
